﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using SDF.Primitives;
using System.ComponentModel;

namespace SDF
{
    public class TableColumn: SmartDataObject, IValidateParent
    {
        #region Constructor

        public TableColumn()
        {
        }

        #endregion

        #region Dependency Properties

        public static readonly DependencyProperty BackgroundProperty = DependencyProperty.Register(
            "Background",
            typeof(Brush),
            typeof(TableColumn),
            new PropertyMetadata(null));

        public static readonly DependencyProperty WidthProperty = DependencyProperty.Register(
            "Width",
            typeof(GridLength),
            typeof(TableColumn),
            new PropertyMetadata(GridLength.Auto));

        #endregion

        #region Properties

        public Brush Background
        {
            get { return (Brush)GetValue(BackgroundProperty); }
            set { SetValue(BackgroundProperty, value); }
        }

        public GridLength Width
        {
            get { return (GridLength)GetValue(WidthProperty); }
            set { SetValue(WidthProperty, value); }
        }

        #endregion

        #region IsVisualProperty 

        protected override bool IsVisualProperty(string propertyName)
        {
            switch (propertyName)
            { 
                case "Background":
                case "Width":
                    return true;

                default:
                    return false;
            }
        }

        #endregion

        #region IValidateParent Implementation

        public bool IsValidParent(DependencyObject parent)
        {
            return parent is Table;
        }

        #endregion

    }
}
